'use client'

import lang from "@/app/i18n"
import CTopNav from '../../components/c-TopNav.js'
import Footer from '../../components/footer'
import { usePathname } from "next/navigation.js"

export default function RootLayout({
    children,
    params: { lng },
}){
    let pathname = usePathname()
    const menus = [
        {
            title: lang('topNav.personAi'),
            href: "/page/person",
        },
        {
            title: lang('topNav.enterpriseAi'),
            href: "/page/enterprise",
        },
        {
            title: lang('topNav.AIMarket'),
            href: "/page/market"
        },
        {
            title: lang('topNav.AICourse'),
            href: "/page/course"
        },
        {
            title: lang('topNav.price'),
            href: "/page/price"
        },
        {
            title: lang('topNav.more'),
            item: [
              {
                title: "关于我们",
                description: "专业团队，提供优质服务",
                href: "/"
              }
            ]
        }
    ]
    menus.map((item) =>{
        console.log('item,pathname', item,pathname)
        if(pathname.indexOf(item.href) !== -1){
            item.isActive = true
        }
    })
    return (
        <div className="page_layout">
           <CTopNav lng={lng} menus={menus}></CTopNav>
          {children}
          <Footer lng={lng}></Footer>
        </div>
    )
}